#ifndef __MediaConnect_
#define __MediaConnect_

#include "network.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define MEDIA_HTTP_SERVER_LOCAL_ADDRESS              "127.0.0.1"
#define MEDIA_HTTP_SERVER_LISTEN_PORT                8600
#define MEDIA_SERVER_SUBCSCRIBE_ACCESCODE            "LionkingSoS"                 //访问MediaServer的接入码

#define MEDIA_WS_SERVER_LISTEN_PORT                  8601
#define MEDIA_API_WS_NOTIFY_PATH                     "/sos/v1/media/notify/ws"     //notify ws path
#define MEDIA_NOTIFY_HEART_PING                      "mediaHeartPing"              //MediaServer 的心跳消息
#define MEDIA_NOTIFY_HEART_RESPONSE                  "mediaHeartRsp"               //回复MediaServer心跳的消息

typedef void (*MediaDataCallback)(const char *taskCode, char *recvMsg, int msgLength);
typedef void (*MediaAuthCodeCallback)(void *userData, const char *authCode);

int media_load_connect_moudle();

const char *media_get_auth_code();

int media_refresh_auth_code(void *userData, MediaAuthCodeCallback authCodeCallback);

int media_build_data_channel(const char *taskCode, const char *wsUrl, int wsPort, MediaDataCallback dataCallback);
int media_release_data_channel(const char *taskCode);

cJSON *isRequestSuccess(sos_nw_rsp_t *rspBody, void *userData, int *status, const char *tag);


#ifdef __cplusplus
}
#endif

#endif